import java.util.Scanner;

public class Test0802 {
    static Scanner scan = new Scanner(System.in);

    public static void main(String[] args) {
//        String user = "zhangsan", password = "123";
//        boolean loginState = login(user, password); // 实参
//        if (loginState) {
//
//        } else {
//
//        }
        // 接收 string char 字符在字符串里第一次出现的下标
//        String str = "kashfutefksbcxuwgierf";
//        System.out.println("请输入查找字符：");
//        String cha = scan.next();
//        int index = findIndex(str, cha);
//        System.out.println("下标在：" + index);

        String[] userArr = {"zhangsan", "lisi"};
        String[] passwordArr = {"123", "456"};
        double[] accountArr = {500, 1000};

    }

    // 查找下标
    public static int findIndex(String str, String c) {
        char[] charArr = str.toCharArray(); // 字符数组
        char cha = c.toCharArray()[0]; // 字符串-> char 数组 -> 0 -> c

        for (int i = 0; i < charArr.length; i++) {
            if (cha == charArr[i]) {
                return i;
            }
        }
        return -1;
    }


    // 登录
    public static boolean login(String username, String password) { // 需要账号密码
        System.out.println("请输入账号：");
        String iptUsername = scan.next();
        System.out.println("请输入密码：");
        String iptPassword = scan.next();
        if (iptUsername.equals(username) && iptPassword.equals(password)) {// 成功
//            System.out.println("欢迎");
            return true;
        } else {
//            System.out.println("错误");
            return false;
        }
    }

}
